package com.iss.okair.db.mapper;

import com.iss.okair.db.entity.Category;
import com.iss.okair.db.entity.CategoryParent;

import com.iss.okair.db.mapper.sql.CategorySQL;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

public interface CategoryMapper {
    //条件查询接口
    @SelectProvider(type=CategorySQL.class,method = "findgory")
    List<Category> selectByExample(Category example);
    //查询接口
    @Select("select distinct id as parentid,namecn from category")
    List<CategoryParent> getparentlist();

    @Select("select * from category where parentId=#{parentId}")
    List<Category> selectByParentId(@Param("parentId") int parrntId);

    //根据主键id查询信息的方法
    @Select("select * from category where id=#{id}")
    Category selectById(@Param("id") int id);

}
